//
//  AfterSaleTableViewCell.m
//  AnXin100
//
//  Created by Sakura on 2018/11/5.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "AfterSaleTableViewCell.h"

@interface AfterSaleTableViewCell ()

@property (nonatomic, strong) UIImageView *iconImage;

@property (nonatomic, strong) UILabel *nameLabel;

@property (nonatomic, strong) UILabel *detailLabel;

@property (nonatomic, strong) UIView *line;

@property (nonatomic, strong) UIImageView *goImage;

@end

@implementation AfterSaleTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatCell];
    }
    return self;
}

- (void)creatCell {
    _iconImage = [[UIImageView alloc] init];
    [self.contentView addSubview:_iconImage];
    
    _nameLabel = [UILabel getCustomLabel:[UIColor colorWithHex:0x333333] font:FONT_FOURTEEN rect:CGRectNull];
    [self.contentView addSubview:_nameLabel];
    
    _detailLabel = [UILabel getCustomLabel:[UIColor colorWithHex:0x666666] font:FONT_TWELVE rect:CGRectNull];
    [self.contentView addSubview:_detailLabel];
    
    _line = [[UIView alloc] init];
    _line.backgroundColor = [UIColor colorWithHex:0xf6f6f6];
    [self.contentView addSubview:_line];
    
    _goImage = [[UIImageView alloc] init];
    _goImage.image = [UIImage imageNamed:@"skip"];
    [self.contentView addSubview:_goImage];
    
}

- (void)setDic:(NSDictionary *)dic {
    _dic = dic;
    _iconImage.image = [UIImage imageNamed:_dic[@"icon"]];
    _nameLabel.text = _dic[@"name"];
    _detailLabel.text = _dic[@"detail"];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    _iconImage.sd_layout
    .topSpaceToView(self.contentView, 20)
    .leftSpaceToView(self.contentView, 10)
    .widthIs(30)
    .heightIs(30);
    [self.contentView layoutIfNeeded];
    
    _nameLabel.sd_layout
    .leftSpaceToView(_iconImage, 10)
    .topEqualToView(_iconImage)
    .rightSpaceToView(self.contentView, 10)
    .heightIs(15);
    [self.contentView layoutIfNeeded];
    
    _detailLabel.sd_layout
    .leftEqualToView(_nameLabel)
    .bottomSpaceToView(self.contentView, 15)
    .rightEqualToView(_nameLabel)
    .heightIs(15);
    
    _line.frame = CGRectMake(0, self.mj_h - 1,SCREEN_WIDTH , 1);
    
    _goImage.frame = CGRectMake(SCREEN_WIDTH - 30, self.mj_h / 2 - 10, 20, 20);
}




- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
